package system

import (
	"mytest/initialize/database"
	"mytest/models"
)

func JornBlackList(token string) error {
	black := models.BlackTokenList{
		Token: token,
	}
	return database.GetDB().Create(&black).Error
}
func IsBlacklist(token string) (bool, error) {
	var count int64
	if err := database.GetDB().Model(models.BlackTokenList{}).Where("token = ?", token).Count(&count).Error; err != nil {
		return false, err
	}
	if count == 0 {
		return false, nil
	}

	return true, nil
}
